<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script type="text/javascript">
			function addEvent(){
				let btn1=document.querySelector("button")
				btn1.addEventListener("click",test)
			}
			function test(){
				alert("监听器添加成功")
			}
		</script>
	</head>
	<body>
		<button type="button">按钮</button>
		<button type="button" onclick="addEvent()">添加</button>
		<button type="button">移除</button>
		<script type="text/javascript">
			let btn3=document.querySelectorAll("button")[2]
			btn3.onclick=function(){
				let btn1=document.querySelector("button")
				btn1.removeEventListener("click",test)
			}
		</script>
	</body>
</html>
